


#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

const int32_t rtt_buffer_length = 3;

std::vector<int32_t> rtt_buffer {550, 550, 550};

int32_t calcl_rtt(int32_t rtt, int32_t index) {

    rtt_buffer[index%rtt_buffer_length] = rtt;
    return std::accumulate(rtt_buffer.cbegin(), rtt_buffer.cend(), 0)/rtt_buffer_length;

}

struct my_test {

    char* buf;
};

void test_case() {

    my_test test;
    my_test* p_test = &test;
    p_test->buf = NULL;

    if (!p_test->buf) { 
        std::cout << "hitted" << std::endl;
    } else {
        std::cout << "not hitted" << std::endl;
    } 

}


int main() {

    std::vector<int> v1;

    v1.push_back(10);
    v1.push_back(12);
    v1.push_back(14);
    v1.push_back(15);
    v1.push_back(16);
  
    std::cout << "main " << std::accumulate(v1.cbegin(), v1.cend(), 0) << std::endl;

    std::cout << "rtt value " << calcl_rtt(550, 0) << std::endl;

    test_case();
    
    return 0;
}